package com.cyy.demo.classtest.applicationContextAware;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DataController {

    @Autowired
    private MyApplicationContextAware applicationContextAware;

    @GetMapping("/handler/{str}")
    public String  handler(@PathVariable String str){

        String res = "";
        if(str.equals("zhsq")){

            HandlerData handlerData = applicationContextAware.getBeanMap().get(BeanName.handlerData2zhsqFace.toString());
             res = handlerData.analyzeData("hello");
        }else {
            HandlerData handlerData = applicationContextAware.getBeanMap().get(BeanName.handlerData2viasFace.toString());
             res = handlerData.analyzeData("hello");
        }
        return res;
    }
}
